package backpropagationv1;

public class Funcion {

    /*CONSTRUCTORES*/
    public Funcion(int s, int _t){
        this.selec = s;
        this.t = _t;
    }

    /*METODOS*/
    private float lineal(float x){
        return x+t;
    }

    private float binaria(float x){
       if(x >= t) r = 1;
       else if(x < t) r = 0;
       return r;
    }

    private float sigmoide(float x){
        r = (float) ( 1 / (1 + (float) Math.pow(Math.E, -(x - t))));
        return r;
    }

    public float eval(float x){
        switch(selec){
            case 1: result = lineal(x); break;
            case 2: result = binaria(x); break;
            case 3: result = sigmoide(x); break;
        }
        return result;
    }

    /*VARIABLES GLOBALES DE LA CLASE*/
    private int selec;
    private float t=0;
    private float result,r;
}
